const mongoose = require('mongoose');
const schema = new mongoose.Schema({
  name:{
    type: String
  },
  avatar: {
    type: String
  },
  title: {
    type: String
  },
  heroCategories: [{
    //一个英雄可能有多种分类,使用数组定义
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'Category'
  }],
  //英雄的评分,多个评分，定义符合类型
  scores:{
    difficult: {type: Number},
    skills: {type: Number},
    attack: {type: Number},
    survive: {type: Number},
  },
  //每个英雄的技能
  skills: [{
    icon: {type: String},
    name: {type: String},
    description: {type: String},
    tips: {type: String},
  }],
  //出装推荐，物品,顺风出装，逆风出装,通过关联装备库区选取装备,两套装备
  items1: [
    {
      type: mongoose.SchemaTypes.ObjectId,
      ref: 'Items'
      //顺风出装
    }
  ],
  items2: [
    {
      type: mongoose.SchemaTypes.ObjectId,
      ref: 'Items'
      // 逆风出装
    }
  ],
  //使用技巧
  usageTips: {type: String},
  //对抗技巧
  battleTips: {type: String},
  // 团战思路
  teamTips: {type: String},
  //英雄关系： 最佳搭档，被谁克制，克制谁
  //最佳搭档
  partners: [{
    hero: {type: mongoose.SchemaTypes.ObjectId, ref: 'Hero'},
    description: { type: String }
  }],
  //被谁克制
  // restrained: [{
  //   hero: {type: mongoose.SchemaTypes.ObjectId, ref: 'Hero'},
  //   description: { type: String }
  // }],
  // 克制谁
  // restraints: [{
  //   hero: {type: mongoose.SchemaTypes.ObjectId, ref: 'Hero'},
  //   description: { type: String }
  // }],
});
const Hero = mongoose.model('Hero', schema);
module.exports = Hero;
